//路由模块
import Vue from "vue";
import VueRouter from 'vue-router';

//安装路由插件
Vue.use(VueRouter);

//导入需要组件
import UserList from "@/components/UserList";
import UserDetail from "@/components/UserDetail";

//创建路由实例对象
const router = new VueRouter({
    //路由规则
    routes: [
        //路由重定向
        {path: '/', redirect: '/users'},
        //用户列表路由
        {path: '/users', component:UserList},
        {path:'/users/:id',component:UserDetail}
    ]
})

//像外共享路由实例对象
export default router

